{% block doctype %}<!doctype html>{% endblock %}
<!--[if lt IE 9]><html class="ie" lang="{{ lang|default:"en" }}" class="{% block html.class%}{% endblock %}" dir="{{LANGUAGE_BIDI|yesno:"rtl,ltr"}}"{% block html.extra %}{% endblock %}><![endif]-->
<!--[if gte IE 9]><!--><html lang="{{ lang|default:"en" }}" class="{% block html.class%}{% endblock %}" dir="{{LANGUAGE_BIDI|yesno:"rtl,ltr"}}"{% block html.extra %}{% endblock %}><!--<![endif]-->
{# The comment jumble above is handy for targeting old IE with CSS. - http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ #}
<head>
    {% block site.head %}
    {# Site title #}
    {% block site.title %}<title>{% block app.title %}{% endblock %}{% block project.title %}{% endblock %}</title>{% endblock %}
    {# Metas #}
    {% block site.meta %}
    {# Please don't add "maximum-scale=1" here. It's bad for accessibility. #}
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    {% block project.meta %}
    <meta name="description" content="{% block project.description %}{% endblock %}">
    <meta name="keywords" content="{% block project.keywords %}{% endblock %}">
    {% endblock %}
    {% block app.meta %}{% endblock %}
    {% endblock %}
    {# Favicon #}
    {% block project.favicon %}
    <link rel='shortcut icon' href="{{ MEDIA_URL }}img/favicon.ico" />
    {% endblock%}
    
    <script src="{{ STATIC_URL }}goldengridsystem/GGS.js"></script>
    <!--[if lt IE 9]><script src="{{ STATIC_URL }}libs/html5shiv/html5.min.js"></script><![endif]-->

    {% block site.headstyles %}
    <link rel="stylesheet" href="{{ STATIC_URL }}goldengridsystem/GGS.css"/> 
    {% block project.headstyles %}{% endblock%}
    {% block app.headstyles %}{% endblock%}
    {% endblock %}

    {% block site.headscripts %}
    {% block project.headscripts %}{% endblock %}
    {% block app.headscripts %}{% endblock %}
    {% endblock %}
    
    {% endblock %}
</head>
	
<body lang="{{ lang|default:"en" }}">
    {% block site.body %}
    {% block project.head %}{% endblock %}
    {% block project.body %}{% endblock %}
    {% block project.footer %}{% endblock %}
    {% frontadmin_bar request %}
    {% endblock %}

    {% block site.styles %}
    {% block project.styles %}{% endblock%}
    {% block app.styles %}{% endblock%}
    {% endblock %}

    {% block site.scripts %}
    {# Javascript at the bottom for fast page loading #}
    <script src="{{ STATIC_URL }}libs/jquery/jquery.min.js"></script>
    <script>!window.jQuery && document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"><\/script>');</script>
    <script src="{{ STATIC_URL }}plugins/jquery.cookie.js"></script>
    <script>
      var django = (function($){
          var _urls = {}
          var _conf = {}
          return {
              settings: {
                  'MEDIA_URL':  '{{ MEDIA_URL }}',
                  'STATIC_URL': '{{ STATIC_URL }}'
              },

              i18n: function() {
                  var strs = {};
                  var get = function(k)    { return _conf[k] }
                  var set = function(k, v) { return _conf[k] = v }
                  return arguments.length == 2 
                      && set(arguments[0], arguments[1]) 
                      || get(arguments[0])
              },

              urls: function() {
                  var get = function(k)    { return _urls[k] }
                  var set = function(k, v) { return _urls[k] = v }
                  return arguments.length >= 2 
                      && set(arguments[0], arguments[1]) 
                      || get(arguments[0])
              }
          }
      })(jQuery)

      {# http://www.djangoproject.com/weblog/2011/feb/08/security/ #}
      {# http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax #}
      $.ajaxSetup({
          beforeSend: function(xhr, settings) {
              if ($.cookie('csrftoken') && (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url)))) {
                  xhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken'))
              }
          }
      });
    </script>
    {% block project.scripts %}{% endblock%}
    {% block app.scripts %}{% endblock%}
    {% endblock%}
    {% block site.frontadmin %}
    {% if user.is_authenticated and user.is_staff %}
    {% include "frontadmin/frontadmin.inc.html" %}
    {% endif %}
    {% endblock %}
</body>
</html>
